// 云函数入口文件
const cloud = require('wx-server-sdk')
const request = require('request');
cloud.init()

// 云函数入口函数
exports.main = async(event, context) => {
  let appid = event.userInfo.appId;
  let secret='';
  let opts = {
    url : `https://api.weixin.qq.com/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code`
  }
  request(opts, (err, data) => {
    if (err) return console.warn('网络错误');
    return data;
  })
}